package de.bazinga.rotw.person;

import java.util.Hashtable;
import java.util.Vector;


public class OpponentList {
	private Hashtable<Integer,Person> opponents = new Hashtable<Integer,Person>();
	
	private static OpponentList instance = null;
	
	private OpponentList() {
		
	}
	
	public static OpponentList getInstance() {
		if(instance == null) instance = new OpponentList();
		return instance;
	}
	
	public void addOpponent(int playerId, Person b) {
		opponents.put(playerId,b);
	}
	
	public void removeOpponent(int playerId) {
		opponents.remove(playerId);
	}
	
	public Hashtable<Integer,Person> getOpponents() {
		return opponents;
	}
	
	public Person getOpponent(int playerId) {
		return opponents.get(playerId);
	}
	
	public void removeAll() {
		opponents.clear();
	}
	
	
	
	public Vector<String> getScoreList() {
		Vector<String> scores = new Vector<String>();
		
		for(Person p:opponents.values()) {
			scores.add(p.getScore()+"__::__"+p.getPlayerName()+"__::__"+p.getTeam());
		}
		
		return scores;
	}
}
